package io.renren.modules.upk.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.upk.entity.UpkTradeSubGoodOrderEntity;
import io.renren.modules.upk.service.UpkTradeSubGoodOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 收订单列表，保存会员发生的交易订单。
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2018-05-29 20:29:24
 */
@RestController
@RequestMapping("generator/upktradesubgoodorder")
public class UpkTradeSubGoodOrderController {
    @Autowired
    private UpkTradeSubGoodOrderService upkTradeSubGoodOrderService;

    /**
     * 列表
     */
    @RequestMapping("/list")
//    @RequiresPermissions("upk:upktradesubgoodorder:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = upkTradeSubGoodOrderService.queryPage(params);

        return R.ok().put("page", page);
    }
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
//    @RequiresPermissions("upk:upktradesubgoodorder:info")
    public R info(@PathVariable("id") Long id){
			UpkTradeSubGoodOrderEntity upkTradeSubGoodOrder = upkTradeSubGoodOrderService.selectById(id);

        return R.ok().put("upkTradeSubGoodOrder", upkTradeSubGoodOrder);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
//    @RequiresPermissions("upk:upktradesubgoodorder:save")
    public R save(@RequestBody UpkTradeSubGoodOrderEntity upkTradeSubGoodOrder){
			upkTradeSubGoodOrderService.insert(upkTradeSubGoodOrder);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
//    @RequiresPermissions("upk:upktradesubgoodorder:update")
    public R update(@RequestBody UpkTradeSubGoodOrderEntity upkTradeSubGoodOrder){
			upkTradeSubGoodOrderService.updateById(upkTradeSubGoodOrder);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
//    @RequiresPermissions("upk:upktradesubgoodorder:delete")
    public R delete(@RequestBody Long[] ids){
			upkTradeSubGoodOrderService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }

}
